package com.qingfeng.core.dao.qingfeng;


import com.qingfeng.core.config.database.BaseMapper;
import com.qingfeng.core.dao.BaseDao;
import com.qingfeng.core.entity.qingfeng.AppVersion;
import com.qingfeng.core.mapper.qingfeng.AppVersionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

/**
 * @description: 用户dao
 * @author:LWY
 * @date: 2017/10/16 17:15
 * @modified:
 */

@Repository
public class AppVersionDao extends BaseDao<AppVersion> {

    @Autowired
    AppVersionMapper appVersionMapper;

    @Override
    protected BaseMapper<AppVersion> getBaseMapper() {
        return appVersionMapper;
    }

    /**
     * 根据版本号获取版本
     *
     * @param version_num 版本号
     * @param type        客户端类型（1：Android，2：ios）
     * @return
     */
    public AppVersion getByVersionNum(String version_num, int type) {
        AppVersion appVersion = new AppVersion();
        appVersion.setVersion_num(version_num);
        appVersion.setType(type);
        return appVersionMapper.selectOne(appVersion);
    }
}
